package com.hxc.web.controller.interest;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hxc.common.annotation.Log;
import com.hxc.common.core.controller.BaseController;
import com.hxc.common.core.domain.AjaxResult;
import com.hxc.common.enums.BusinessType;
import com.hxc.interest.domain.TReactionDiscuss;
import com.hxc.interest.service.ITReactionDiscussService;
import com.hxc.common.utils.poi.ExcelUtil;

/**
 * 用户评论信息Controller
 * 
 * @author hxc
 * @date 2021-08-18
 */
@Api(tags = "反馈评论管理")
@RestController
@RequestMapping("/interest/discuss")
public class TReactionDiscussController extends BaseController
{
    @Autowired
    private ITReactionDiscussService tReactionDiscussService;

    /**
     * 查询用户评论信息列表
     */
    @GetMapping("/list")
    public AjaxResult list(TReactionDiscuss tReactionDiscuss)
    {
        List<TReactionDiscuss> list = tReactionDiscussService.selectTReactionDiscussList(tReactionDiscuss);
        return AjaxResult.success(list);
    }

    /**
     * 导出用户评论信息列表
     */
    @Log(title = "用户评论信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TReactionDiscuss tReactionDiscuss)
    {
        List<TReactionDiscuss> list = tReactionDiscussService.selectTReactionDiscussList(tReactionDiscuss);
        ExcelUtil<TReactionDiscuss> util = new ExcelUtil<TReactionDiscuss>(TReactionDiscuss.class);
        return util.exportExcel(list, "用户评论信息数据");
    }

    /**
     * 获取用户评论信息详细信息
     */
    @ApiOperation(value = "查询评论信息", notes = "查询")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tReactionDiscussService.selectTReactionDiscussById(id));
    }

    /**
     * 新增用户评论信息
     */
    @ApiOperation(value = "添加评论信息", notes = "添加")
    @Log(title = "用户评论信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TReactionDiscuss tReactionDiscuss)
    {
        return toAjax(tReactionDiscussService.insertTReactionDiscuss(tReactionDiscuss));
    }

    /**
     * 修改用户评论信息
     */
    @Log(title = "用户评论信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TReactionDiscuss tReactionDiscuss)
    {
        return toAjax(tReactionDiscussService.updateTReactionDiscuss(tReactionDiscuss));
    }

    /**
     * 删除用户评论信息
     */
    @ApiOperation(value = "删除评论信息", notes = "查询")
    @Log(title = "用户评论信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tReactionDiscussService.deleteTReactionDiscussByIds(ids));
    }

}
